package org.tong.controller;

import com.alibaba.nacos.api.config.annotation.NacosValue;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

@RestController
@RefreshScope
public class EchoController {

    @Value("${name:xiaoming}")
    private String name;

    @RequestMapping("/echo/{msg}")
    public String echo(@PathVariable(name = "msg") String msg) {
        return "Hello Nacos Discovery -> msg: " + msg + "\t name:" + name + "\t" + new Date();
    }
}
